<?php

	class cct_delivery extends ctl_delivery
	{
		/**
		* detailDlType
		*
		* @access public
		* @return void
		*/
		function detail($nDTid)
		{
			$oObj = $this->system->loadModel('trading/delivery');
			$aData = $oObj->getDlTypeById($nDTid);

			$aData['protect_rate'] *= 100;
			$aRel = $oObj->getRelByDid($nDTid);
			$aData['area_exp'] = unserialize($aData['area_exp']);
			$aArea = $oObj->getDlAreaList();
			$aArea = $aArea;
			if($aArea){
				foreach($aArea as $key=>$val){
					$aRlt[$val['area_id']] = $key;
					$aArea[$key]['checked'] = $aRel[$val['area_id']]?true:false;
				}
			}
			if($aRel){
				foreach($aRel as $val){
					if($val['area_id']){
						$aArea[$aRlt[$val['area_id']]]['checked'] = true;
						$aArea[$aRlt[$val['area_id']]]['price'] = $val['price'];
						$aArea[$aRlt[$val['area_id']]]['cod'] = $val['has_cod'];
						$aArea[$aRlt[$val['area_id']]]['expressions'] = $val['expressions'];
					}else{
						$aArea[$aRlt[$val['area_id']]]['checked'] = false;
						$aArea[$aRlt[$val['area_id']]]['price'] = 0;
						$aArea[$aRlt[$val['area_id']]]['cod'] = 0;
						$aArea[$aRlt[$val['area_id']]]['expressions'] = '';
					}
				}
			}
			$this->pagedata['dtype'] = $aData;
			$this->pagedata['dt_id'] = $nDTid;
			$this->pagedata['area'] = $aArea;
			$this->pagedata['hasCod'] = $aData['has_cod'];
			$corp=$this->system->loadModel('trading/deliverycorp');
			$this->pagedata['clist'] = $corp->getCorpList();
			$this->pagedata['corp_id'] = $aData['corp_id'];
			$this->pagedata['maxWeight'] = $aData['maxWeight'];		//最大重量
			$this->setView('delivery/dtype_edit.html');
			$this->output();
		}
	}

?>